package com.zerui.manager.web.enums;

import lombok.Getter;

/**
 * @Author wh
 * @create_time 2023-08-25 14:23
 */

@Getter
public enum SuccessAndFailureEnum {

	SUCCESS(0,"成功"),
	FAILURE(1,"失败"),
    ;

    private final Integer code;

    private final String name;

    SuccessAndFailureEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public static String getNameByCode(Integer code){
        SuccessAndFailureEnum[] values = SuccessAndFailureEnum.values();
        for (SuccessAndFailureEnum passTypeEnum : values) {
            if(passTypeEnum.getCode().equals(code)){
                return passTypeEnum.getName();
            }
        }
        return null;
    }

}
